home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / MMULib / Fixes / ConsoleFix.readme < prev    next >
Encoding:
Text File  |  2002-03-13  |  3.1 KB  |  97 lines

  1. Short:    Fix a bug in the console.device
  2. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  3. Author:   thor@math.tu-berlin.de (Thomas Richter)
  4. Type:     util/boot
  5. Version:  1.01
  6. Requires: Os 3.0 (V39) or better
  7.  
  8. *** Obsolete for Os version 3.9. ***
  9.  
  10. _____________________________________________________________________________
  11.  
  12. Changes made in release 1.01:
  13.  
  14. -ConsoleFix 1.00 failed from time to time if the console.device main task was, 
  15. due to some unfortune, not waiting in its main loop. Added a workaround
  16. that checks several times.
  17.  
  18. -Added a version tag.
  19. _____________________________________________________________________________
  20.  
  21.  
  22. Purpose of this program:
  23.  
  24. This little patch fixes possible crashes of the console.device task, which,
  25. luckely, do not show up under "normal" circumstances. However, as soon as
  26. the console.device supervisor task takes more stack than usual, or this
  27. stack is filled by more than just zeros, the console device will crash on
  28. window resizes.
  29.  
  30. The reason for this crash is that the console.device main task uses a
  31. faulty algorithm to traverse an exec style list: The list header is
  32. also processed as a "node". Due to some lucky coincidences, the only data
  33. that gets querried by this faulty node is on the stack of the console device,
  34. and again due to some coincidence, this points to an area of the stack which
  35. is usually set to zero. All provided the stack of the console.device doesn't 
  36. grow too much.
  37.  
  38. For the experts: 
  39.  
  40.     The main loop of the console device looks like this:
  41.  
  42.     lea WindowList(a6),a2        ;get the head of the window list
  43. .loop:
  44.     bsr ProcessWindow        ;re-calcutes the window on a resize
  45.  
  46.     move.l (a2),a2            ;get next node
  47.     tst.l (a2)            ;end of list?
  48.     bne.s .loop
  49.  
  50. Hence, the list header is processed as a first node. Urgh!
  51.  
  52.  
  53. The correct method would have been:
  54.  
  55.  
  56.     lea WindowList(a6),a2        ;get the head of the window list
  57.     bra.s .into
  58. .loop:
  59.     bsr ProcessWindow        ;re-calcutes the window on a resize
  60. .into:
  61.     move.l (a2),a2            ;get next node
  62.     tst.l (a2)            ;end of list?
  63.     bne.s .loop
  64.  
  65.  
  66. This program fixes this bug by "hacking in" a new main loop for the console
  67. device, the source code is included.
  68.  
  69. I'm sorry for the uglyness of this patch, it was designed at 2 a.m. in the
  70. night and I was all than awake. It currently works like it is, but I'd really
  71. prefer if someone could write a "nicer" fix, or if AI would include this fix
  72. in the "SetPatch" program.
  73.  
  74. _____________________________________________________________________________
  75.  
  76. Credits:
  77.  
  78. Thanks goes to Nils Goers and his StackSnoop program. This console.device
  79. problem showed up while Nils was beta-testing his program, and I was
  80. curious what could have caused the crash. Stack-Snoop fills the application
  81. stack with a "magic cookie" to find out the true stack size a program re-
  82. quires, and this magic cookie caused the buggy code above to get mad.
  83. Always interested in the true reason for a crash, I found the above bug...
  84.  
  85. _____________________________________________________________________________
  86.  
  87. Copyright:
  88.  
  89.     None, this is freeware, public domain. Do whatever you want to do
  90.     with it.
  91.  
  92. _____________________________________________________________________________
  93.  
  94.  
  95. Thomas,
  96.     January 1999
  97.